#!/usr/bin/env python
#coding=utf-8 

# 作用域
def foo():
	m = 3
	def bar():
		n = 4
		print m+n
#print m
#bar()

# 闭包
def counter(start_at=0):
	count = [start_at]
	def incr():
		count[0] += 1
		return count[0]
	return incr

count = counter(5) # 似乎作用域都在局部变量里面  一直调用的是局部变量
print count()
print count()

